//得到类名下面的所有class
function getClass(classnames) {
    let classObj = [];//定义数组
    let classInt = 0;//定义数组的下标
    let tags = document.getElementsByTagName("*"); //获取HTML的所有标签
    for (let index = 0; index < tags.length; index++) {
        if (tags[index].nodeType === 1) {//判断节点类型
            if (tags[index].getAttribute("class") === classnames)//判断和需要CLASS名字相同的，并组成一个数组
            {
                classObj[classInt] = tags[index];
                classInt++;
            }
        }
    }
    return classObj;//返回组成的数组
}
/************解析url后面的问号对应的数据，例如：http://localhost:8080/photoShareProject/share/rank?kind=day*/
function parseURL(url) {
    let a = document.createElement('a');
    a.href = url;
    return {
        source: url,
        protocol: a.protocol.replace(':', ''),
        host: a.hostname,
        port: a.port,
        query: a.search,
        params: (function () {
            let ret = {},
                seg = a.search.replace(/^\?/, '').split('&'),
                len = seg.length, i = 0, s;
            for (; i < len; i++) {
                if (!seg[i]) {
                    continue;
                }
                s = seg[i].split('=');
                ret[s[0]] = s[1];
            }
            return ret;
        })(),
        file: (a.pathname.match(/\/([^\/?#]+)$/i) || [, ''])[1],
        hash: a.hash.replace('#', ''),
        path: a.pathname.replace(/^([^\/])/, '/$1'),
        relative: (a.href.match(/tps?:\/\/[^\/]+(.+)/) || [, ''])[1],
        segments: a.pathname.replace(/^\//, '').split('/')
    };
}
